function [position,isterminal,direction] =Angle180(t,S,GM_central,u,DU,VU)
pos = [S(1:2);0];
vel = [S(3:4);0];


S_i_crtbp = [pos;vel];
S_i_inert = C2I_new(S_i_crtbp,u,DU,VU,t);

COE = State2Coe(S_i_inert,GM_central);


position = COE(6)-180;
% if round(position,4)==0
%     keyboard
% end
if S(2) < 0.1
    isterminal =0;
else
    isterminal = 1;
end
direction = 0;   % The zero can be approached from either direction